import myRequest from "./config/request";

const URL = "/users";

export function getUserListApi(currentPage, pageSize) {
  return myRequest.post({
    url: URL + "/getUserList",
    data: {
      currentPage,
      pageSize,
    },
  });
}
export function createUserApi(userObj) {
  return myRequest.post({
    url: URL + "/createUser",
    data: {
      userObj,
    },
  });
}

export function updateUserApi(id, userObj) {
  return myRequest.post({
    url: URL + "/updateUser",
    data: {
      id,
      userObj,
    },
  });
}

export function deleteUserApi(id) {
  return myRequest.get({
    url: URL + "/deleteUser/" + id,
  });
}

export function updateUserPasswordByIdApi(id, password, newPassword) {
  return myRequest.post({
    url: URL + "/updateUserPasswordById",
    data: {
      id,
      password,
      newPassword,
    },
  });
}
